<?php
header("Content-Type:text/html;charset=utf-8");
session_start();
$user=isset($_POST['user'])?$_POST['user']:'';
$pwd=isset($_POST['pwd'])?$_POST['pwd']:'';
$act=isset($_GET['act'])?$_GET['act']:'';
$auths=isset($_POST['auths'])?$_POST['auths']:'';
include 'includes/init.php';
if ($user!=''&&$pwd!=''){
	
	$sql="select * from t_member where company_data='{$user}' and passwords='{$pwd}'";

	$resArr=$db_Obj->getone($sql);
	if (!empty($resArr)){
		$_SESSION['uesrname']=$resArr['names'];
		$_SESSION['id']=$resArr['id'];
		$_SESSION['phone']=$resArr['phone'];
		$_SESSION['GID']=$resArr['type_id'];
		$_SESSION['company_names']=$resArr['company_name'];
		$_SESSION['rate']=$resArr['rate'];
		// 验证声明
		if(empty($resArr['agreement'])){
			halt("install.php","登陆成功",0);
		}


        halt("index.php","登陆成功",0);
    }
	else{
		halt("login.php","登陆失败",2);
	}
}
// 退出登录
if ($act="loginout") {
	
	unset($_SESSION['uesrname']);
	unset($_SESSION['id']);
	unset($_SESSION['phone']);
	unset($_SESSION['GID']);
	unset($_SESSION['company_names']);
	unset($_SESSION['rate']);
//  halt("http://47.106.133.161:9080","退出成功",0);
}
?>
<html>
<head>

<title>网页标题</title>
<script src="includes/jquery-1.7.1.js"></script>
<style type="text/css">
.content{width: 300px;height: 200px;margin:200px auto;padding-left: 250px;}
.ipt{height: 50px;line-height: 50px;margin-top: 10px;color: #fff}
.ipt_01{color: #333;font:14px 'Microsoft Yahei';padding-left: 10px}

.STYLE1 {color: #FFFFFF}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: none;
}
a:active {
	text-decoration: none;
}
.STYLE8 {font-size: 14px}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3" align="center"><a href="http://www.ego-buy.com.cn/"><img src="image/bg3.jpg" width="990" height="96" border="0"></a></td>
      </tr>
      <tr>
        <td width="63%" align="right" bgcolor="#305EA9"><img src="image/bg.jpg" width="700" height="470"></td>
        <td width="18%" bgcolor="#305EA9">
            <form action="login.php" method="post"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="28%" align="center"><span class="STYLE1">账号：</span></td>
            <td width="72%" height="50"><input type="text" name="user" id="user" class="ipt_01"></td>
          </tr>
          <tr>
            <td align="center"><span class="STYLE1">密码：</span></td>
            <td height="50"><input type="password" class="ipt_01" name="pwd" id="pwd" onBlur="check(2)"></td>
          </tr>
          <tr>
            <td><input style="margin-left: 40px;" type="submit" value="登陆"></td>
            <td height="50"><input type="reset" style="margin-left: 40px" value="重置"></td>
          </tr>
        </table>
        </form>
        </td>
        <td width="19%" bgcolor="#305EA9"></td>
      </tr>
      <tr>
        <td height="100" colspan="3" align="center" valign="bottom"><p><span class="STYLE8"><a rel="nofollow" target="_blank" href="http://www.ego-buy.com.cn/faqListDetail.do?parent_id=108&id=112">集团简介 | </a><a rel="nofollow" target="_blank" href="http://www.ego-buy.com.cn/faqListDetail.do?parent_id=108&id=143">广告服务</a> | <a rel="nofollow" target="_blank" href="http://www.ego-buy.com.cn/faqListDetail.do?parent_id=108&id=115">版权信息 |</a> <a rel="nofollow" target="_blank" href="http://www.ego-buy.com.cn/faqListDetail.do?parent_id=108&id=113">商家入驻 </a> | <a rel="nofollow" target="_blank" href="http://www.ego-buy.com.cn/faqListDetail.do?parent_id=108&id=114">新闻动态</a></span></p>
        </td>
      </tr>
      <tr>
        <td height="30" colspan="3" align="center"><span class="STYLE8">Copyright © 2014-2015 ego-buy.com.cn All Rights Reserved 粤ICP备15026826号</span></td>
      </tr>
    </table>
	<!-- <form action="login.php" method="post">
		<table>
			<tr>
				<td>帐号:</td>
				<td> <input type="text" name="user" id="user" onblur="check(1)">
				<span id="usermsg"></span>
				</td>
				
			</tr>
			<tr>
				<td>密码:</td>
				<td>
				<input type="password" name="pwd" id="pwd" onblur="check(2)">
				<span id="pwdmsg"></span>
				</td>
			</tr>
	
			<tr>
				<td colspan="2"><input type="submit" value="登陆"></td>
				
			</tr>
		</table>
	</form> -->
</body>
<script type="text/javascript">
function ajax(flg){
	var userval=$("#user").val();
	var pwdval=$("#pwd").val();
	curflg=flg=1;
	$.post("login.act.php",{'u':userval,'p':pwdval,'flg':flg},function(d){
		if(curflg==1){
			$("#usermsg").html(d);
			
		}else{
			$("#pwdmsg").html(d);
			}
		},'text')
}
function check(flg){
	
	var path1=/^[a-zA-Z]\w{0,8}$/;
	
	var pathpwd=/^[a-zA-Z0-9!@#$%^&*]{0,12}$/;
	var userval=$("#user").val();
	var pwdval=$("#pwd").val();
	curflg=flg;
	if(flg==1){
		if(path1.test(userval)){ajax(1);}
		else{$("#usermsg").html("请输入以字母开头的0到8位的帐号");}
		}
	else{
		if(pathpwd.test(pwdval)){ajax(2);}
		else{$("#pwdmsg").html("请输入正确密码");}
		}

}
</script>
</html>

<!--	</div>-->
